app_family.controller("controller_mine", function($scope, $rootScope, httpRequest, $location) {
	$rootScope.$broadcast('currentModule', 'page_mine');
	$rootScope.$broadcast('footerFlag', true); // 是否显示底部导航
	
	/**
	 * 判断是否用手机登录过
	 */
	if (sessionStorage.getItem('data_sessionStorage')) {
		var familyPhone = JSON.parse(sessionStorage.getItem('data_sessionStorage')).familyInfo.phone;
		if (familyPhone == '' || familyPhone == null) {
			window.location.replace(basepath + 'login.html');
			return;
		}
	} else {
		window.location.replace(basepath + 'login.html');
		return;
	}
	
	// 根据家属手机号，查询家属个人数据
	/*httpRequest.getMineInfo({
		mobile : familyPhone
	}, function (data) {
		if (data.success === true) {
			$scope.familyInfoObj = data.obj;
			
			$scope.avator_sex = imagebasepath + data.obj.icon; // 头像
		} else if (data.success === false) {
			$.dialog.showToast({msgTxt : data.msg});
		}
	});*/
	
	/**
	 * 退出登录
	 */
	$scope.quitLog = function () {
		$.dialog.showDialog({
			msgTxt : '确定要退出登录吗？',
			isShowBtnCancel : true,
			callbackOk : function () {
				// 清空家属的账号信息
				data_sessionStorage = JSON.parse(sessionStorage.getItem('data_sessionStorage'));
				data_sessionStorage.familyInfo.phone = ''
				sessionStorage.setItem('data_sessionStorage', JSON.stringify(data_sessionStorage));
				
				window.location.replace(basepath + 'login.html');
			}
		});
	};
	
	/**
	 * 模块 跳转页面
	 */
	// 代付订单
	$scope.go_pay = function () {
		// 指定订单列表显示代付订单的tab
		data_sessionStorage = JSON.parse(sessionStorage.getItem('data_sessionStorage'));
		data_sessionStorage.record_page.page_ordertype = '';
    	sessionStorage.setItem('data_sessionStorage', JSON.stringify(data_sessionStorage));
		
		$location.path('/orderlist');
		$scope.$apply();
	};
	// 我的
	$scope.go_family = function () {
		$location.path('/myfamily');
		$scope.$apply();
	};
	// 服务预订订单
	$scope.go_orderlist = function () {
		// 指定订单列表显示预订服务订单的tab
		data_sessionStorage = JSON.parse(sessionStorage.getItem('data_sessionStorage'));
		data_sessionStorage.record_page.page_ordertype = 'getOrderByFamily';
    	sessionStorage.setItem('data_sessionStorage', JSON.stringify(data_sessionStorage));
    	
		$location.path('/orderlist');
		$scope.$apply();
	};
});